package top.kaoshanji.q1ch06d.services;

import org.springframework.stereotype.Service;
import top.kaoshanji.q1ch06d.aspects.ToLog;
import top.kaoshanji.q1ch06d.model.Comment;

import java.util.logging.Logger;

/**
 * @author kaoshanji
 * ^_^
 * create time 2025/4/29 10:42
 */
@Service
public class CommentService {

    private Logger logger = Logger.getLogger(CommentService.class.getName());

    public void setLogger(Logger logger) {
        this.logger = logger;
    }


    public void publishComment(Comment comment) {
        logger.info("发布Comment：" + comment.getText());
    }

    /**
     * 代码清单-q1ch06d-127页b：自定义注解用于希望切面拦截的方法
     * @param comment Comment
     */
    @ToLog
    public void deleteComment(Comment comment) {
        logger.info("删除Comment：" + comment.getText());
    }

    public void editComment(Comment comment) {
        logger.info("编辑Comment：" + comment.getText());
    }


}
